class eventFactory:
  def __init__(self):
    events = []
  
  def add_event(self, type, rate, state, work_required, timed_activate=0):
    self.events.append(Event(type, rate, limit, state, work_required, timed_activate))
  
  def process_events(self,time, work_rate)
    for event in self.events:
      event.process_event(time)
    
class Event:
  def __init__(self, type, rate, limit, state, work_required, timed_activate):
    self.type = type
    self.rate = rate
    self.life = limit
    self.timed_activate = timed_activate
    self.work_required = work_required
    # STATES:
    # active - event is active and the life drains
    # sleep - event is active, but the life stops draining
    # work - player is working on an event
    # incomplete - the life is below or at 0, but the event is not fulfilled
    # complete - event is fulfilled and the life is above 0 
    # inactive - event is not active and will not be processed.
    self.state = "active"
    
   def process_event(self, time, work_rate):
    #Active events at a particular time
    if self.timed_activate > 0:
      if self.state == "inactive":
        self.state = "active"
    #Drain life for active events
    if self.state == "active":
      self.life = self.life - self.rate
      #Oh no! Out of time!
      if self.life <= 0:
        self.state == "incomplete"
    #Player working on an event
    if self.state == "work":
      self.work_required = self.work_required - work_rate
    #Work is done, everything is completed A-OK
    if self.work_required <= 0:
      self.state = "completed"
      
